class Solution {
public:
    int findMaxConsecutiveOnes(vector<int>& nums) {
        int count=0;
        int max=0;
        for(int i=0;i<nums.size();i++){
            int t=nums[i];
            count=0;
            if(t==1){
                count++;
                int j;
                for(j=i+1;j<nums.size();j++){
                    if(nums[j]==1)
                        count++;
                    else {
                        i=j;
                        break;
                    }
                }
                if(count>max)
                    max=count;
            }
        }
        return max;
    }
};